
public class StackPushPopValidatorTest {
    public static void main(String[] args) {
        StackPushPopValidator validator = new StackPushPopValidator();

        // 测试用例1: 正常情况
        int[] push1 = {1, 2, 3, 4, 5};
        int[] pop1 = {4, 5, 3, 2, 1};
        System.out.println(validator.isPopOrderValid(push1, pop1));  // true

        // 测试用例2: 不合法顺序
        int[] push2 = {1, 2, 3, 4, 5};
        int[] pop2 = {4, 3, 5, 1, 2};
        System.out.println(validator.isPopOrderValid(push2, pop2));  // false

        // 测试用例3: 空序列
        int[] push3 = {};
        int[] pop3 = {};
        System.out.println(validator.isPopOrderValid(push3, pop3));  // true

        // 测试用例4: 长度不等
        int[] push4 = {1, 2, 3};
        int[] pop4 = {2, 1};
        System.out.println(validator.isPopOrderValid(push4, pop4));  // false

        // 测试用例5: 完全相反顺序
        int[] push5 = {1, 2, 3};
        int[] pop5 = {3, 2, 1};
        System.out.println(validator.isPopOrderValid(push5, pop5));  // true

        // 测试用例6: 相同顺序
        int[] push6 = {1, 2, 3};
        int[] pop6 = {1, 2, 3};
        System.out.println(validator.isPopOrderValid(push6, pop6));  // true
    }
}

